<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>角色管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        function page(n,s){
            if(n) $("#pageNo").val(n);
            if(s) $("#pageSize").val(s);
            $("#searchForm").attr("action","${ctx}/sys/user/list");
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>
<body>
    <header class="panel-heading no-b">
    <h5><b>字典管理</b></h5>
    </header>
    <div class="panel-body">
    <div class="table-responsive">
    <form:form id="searchForm" modelAttribute="dict" action="${ctx}/sys/dict/" method="post" class="form-inline" cssStyle="padding-bottom: 10px">
        <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
        <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
        <label>类型：</label><form:select id="type" path="type" cssStyle="width:15%;"><form:option value="" label=""/><form:options items="${typeList}" htmlEscape="false"/></form:select>
        <label>描述：</label><input id="title" name="description" type="search" class="form-control" maxlength="50" value="${dict.description}"/>
        <button type="submit" class="btn btn-primary">搜索</button>
    </form:form>
    <sys:message content="${message}"/>
    <table class="table table-striped table-bordered responsive no-m" data-sortable>
        <thead><tr><th>键值</th><th>标签</th><th>类型</th><th>描述</th><th>排序</th><shiro:hasPermission name="sys:dict:edit"><th>操作</th></shiro:hasPermission></tr></thead>
        <tbody>
        <c:forEach items="${page.list}" var="dict">
            <tr>
                <td>${dict.value}</td>
                <td><a href="${ctx}/sys/dict/form?id=${dict.id}">${dict.label}</a></td>
                <td><a href="javascript:" onclick="$('#type').val('${dict.type}');$('#searchForm').submit();return false;">${dict.type}</a></td>
                <td>${dict.description}</td>
                <td>${dict.sort}</td>
                <shiro:hasPermission name="sys:dict:edit"><td>
                    <a href="${ctx}/sys/dict/form?id=${dict.id}">修改</a>
                    <a href="${ctx}/sys/dict/delete?id=${dict.id}&type=${dict.type}" onclick="return confirmx('确认要删除该字典吗？', this.href)">删除</a>
                    <a href="<c:url value='${fns:getAdminPath()}/sys/dict/form?type=${dict.type}&sort=${dict.sort+10}'><c:param name='description' value='${dict.description}'/></c:url>">添加键值</a>
                </td></shiro:hasPermission>
            </tr>
        </c:forEach>
        </tbody>
    </table>
        <div class="text-center">${page}</div>
    </div>
    </div>
</body>
</html>
